package mock

import "fmt"

type Retriever struct {
	Contents string
}

// #1
//func (r Retriever) Get(url string) string {
//	return r.Contents
//}

// #2
//func (r Retriever) Get(url string) string {
//	return r.Contents
//}
//
//// 值接收者，不会改变外面的Contents
//func (r Retriever) Post(url string, form map[string]string) string {
//	r.Contents = form["contents"]
//	return "ok"
//}

// #3
func (r *Retriever) Get(url string) string {
	return r.Contents
}

// 值接收者，不会改变外面的Contents
func (r *Retriever) Post(url string, form map[string]string) string {
	r.Contents = form["contents"]
	return "ok"
}

// #4 Inspecting Retriever {Contents=this is a fake imooc.com}
func (r *Retriever) String() string {
	return fmt.Sprintf("Retriever {Contents=%s}", r.Contents)
}
